﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ListenMusic.AdminSinger_ServiceReference;
using System.ServiceModel;
namespace ListenMusic.Models.Reposistory.Admin
{
    public class ManageSingerReposistory
    {
        ManageSingerServiceClient clientSinger;

        public List<CountrySinger> getAllSinger()
        {
            clientSinger = new ManageSingerServiceClient();
            clientSinger.ClientCredentials.UserName.UserName = "admin";
            clientSinger.ClientCredentials.UserName.Password = "123456";
            try
            {
                CountrySinger[] singer = clientSinger.getAllCountrySinger();
                return singer.ToList();
            }
            catch (FaultException e) { throw e; }
        }
        public bool deleteSinger(int singerid)
        {
            clientSinger = new ManageSingerServiceClient();
            clientSinger.ClientCredentials.UserName.UserName = "admin";
            clientSinger.ClientCredentials.UserName.Password = "123456";
            try
            {
                return clientSinger.deleteSinger_bySingerID(singerid);
            }
            catch (FaultException e) { throw e; }
        }
        public bool insertNewSinger(Singer singer)
        {
            clientSinger = new ManageSingerServiceClient();
            clientSinger.ClientCredentials.UserName.UserName = "admin";
            clientSinger.ClientCredentials.UserName.Password = "123456";
            try
            {
                return clientSinger.insertnewSinger(singer);
            }
            catch (FaultException e) { throw e; }
        }
        public bool ChangeSinger(int singerid)
        {
            clientSinger = new ManageSingerServiceClient();
            clientSinger.ClientCredentials.UserName.UserName = "admin";
            clientSinger.ClientCredentials.UserName.Password = "123456";
            try
            {
                return clientSinger.changeDisplay(singerid);
            }
            catch (FaultException e) { throw e; }
        }
    }
}